/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package main;

import javax.microedition.lcdui.game.Sprite;
import javax.microedition.lcdui.game.TiledLayer;

/**
 *
 * @author Monster
 */
public abstract class QuaiVat {

    protected Sprite _sprite;
    private int _x;
    private int _y;
    protected boolean moving = false;
    protected Sprite[] DoiTuongGayHai;
    protected int iDoiTuongGayHai = 0;
    protected TiledLayer[] VatCanBinhThuong;
    protected int iVatCanBinhThuong = 0;
    protected Sprite[] VatCanDong;
    protected int iVatCanDong = 0;
    
    protected SpriteRandomMovement movement;

    public QuaiVat() {
    }

    public QuaiVat(Sprite _sprite, int x, int y) {
        this._sprite = _sprite;
        this._x = x;
        this._y = y;
        this._sprite.setPosition(x, y);

        this.VatCanBinhThuong = new TiledLayer[5];
        this.DoiTuongGayHai = new Sprite[5];
        this.VatCanDong = new Sprite[40];
    }

    public void ThemDoiTuongGayHai(Sprite s) {
        if (iDoiTuongGayHai < 5) {
            this.DoiTuongGayHai[iDoiTuongGayHai] = s;
            iDoiTuongGayHai++;
        }
    }

    public void ThemVatCanTinh(TiledLayer layer) {
        if (iVatCanBinhThuong < 5) {
            this.VatCanBinhThuong[iVatCanBinhThuong] = layer;
            iVatCanBinhThuong++;
        }
    }

    public void ThemVatCanDong(Sprite s) {
        if (iVatCanDong < 40) {
            this.VatCanDong[iVatCanDong] = s;
            iVatCanDong++;
        }
    }

    public void ViTriDauTien(int x, int y) {
    }

    public void HoatDong() {
    }

    public void Chet() {
        this.moving = false;
        this.movement.stop();
    }

    public Sprite getSprite() {
        return _sprite;
    }

    public void setSprite(Sprite sprite) {
        this._sprite = sprite;
    }

    /**
     * @return the _x
     */
    public int getX() {
        return _x;
    }

    public void setX(int x) {
        this._x = x;
    }

    public int getY() {
        return _y;
    }

    public void setY(int y) {
        this._y = y;
    }
}
